<%-- 
    Document   : ieBill
    Created on : Jul 20, 2011, 12:59:54 AM
    Author     : ThanhToan
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page import="dao.ImportExportBillDAO" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <c:set var="ieList" value="<%= ImportExportBillDAO.getAllImportExportBill() %>" scope="session"></c:set>
        <c:set var="integer" value="1"></c:set>


        <title>Show Import Export Bill Page</title>
    </head>
    <body>
       <div id="main_container">
		<!-- S HEAD CONTENT -->
            <jsp:include page="block/header.jsp" />
            <!-- E HEAD CONTENT -->

            <!-- S Top Menu -->
            <jsp:include page="block/top_menu.jsp" />
            <!-- E Top Menu -->

            <!-- S Navigation -->
            <jsp:include page="block/navigation.jsp" />
            <!-- E Navigation -->

            <!-- S Left Menu -->
            <jsp:include page="block/left_menu.jsp" />
            <!-- E Left Menu -->

		<!-- S Body Content -->
                <div class="center_content">
                <form action="IEBillController" method="post" id="ieBill" name="ieBill">
                    <c:if test="${not empty param.msg and param.msg eq 'update'}">
                        <b class="msg"> Review success! </b>
                    </c:if>
                    <table cellpadding="0" cellspacing="0" border="0" style="background: transparent" align="center">
                        <tr>
                            <td colspan="9" align="center">
                                <h1>Import-ExportBill List</h1>
                            </td>
                        </tr>
                    </table>
                    <table cellpadding="0" cellspacing="0" border="2" style="background: transparent" align="center">
                        <tr>
                            <td align="center" width="20px">No.</td>
                            <th bgcolor= '#186fb2' style="width: 130px"><div class = "div_txtintable1">Date</div></th>
                            <th bgcolor= '#186fb2' ><div class = "div_txtintable1">Customer<br/>(Firstname.Lastname)</div></th>
                            <th bgcolor= '#186fb2'><div class = "div_txtintable1">Status</div></th>
                            <th bgcolor= '#186fb2'><div class = "div_txtintable1">Type</div></th>
                            <th bgcolor= '#186fb2'><div class = "div_txtintable1">Approved By</div></th>
                            <th bgcolor= '#186fb2' style="width: 130px"><div class = "div_txtintable1">LastUpdate</div></th>
                            <th bgcolor= '#186fb2'><div class = "div_txtintable1">Reject Reason</div></th>
                            <th bgcolor= '#186fb2'><div class = "div_txtintable1"></div></th>
                        </tr>
                        <c:forEach var="objIE" items="${ieList}">
                        <tr>
                            <td style="height: 25px">${integer}</td>
                            <td><a href="billDetails.jsp?ieBillID=${objIE.id}&status=${objIE.status}">${objIE.date}</a></td>
                            <td align="center">${objIE.cusName}</td>
                            <td align="center">
                                <c:choose>
                                    <c:when test = "${objIE.status eq 0}">
                                            New
                                    </c:when>
                                    <c:when test = "${objIE.status eq 1}">
                                            Approved
                                    </c:when>
                                    <c:when test = "${objIE.status eq 2}">
                                            Rejected
                                    </c:when>
                                    <c:otherwise>
                                            Close
                                    </c:otherwise>
                                </c:choose>
                            </td>
                            <td align="center">${objIE.type}</td>
                            <td align="center">${objIE.approvedName}</td>
                            <td>${objIE.lastUpdate}</td>
                            <td><textarea rows="3" cols="10" id="txtaReason${integer}" name="txtaReason${integer}"
                                                  <c:if test="${objIE.status ne 0}">readonly</c:if>
                                              >${objIE.rejectReason}</textarea>
                            </td>
                            <td style="width: 75px">
                                <c:if test="${objIE.status eq 0 or objIE.status eq 2}">
                                    <a href="IEBillController?action=review&approve=approve&ieBillID=${objIE.id}"> <img src="images/approve.png" alt="Approve"/> </a>
                                </c:if>
                                <c:if test="${objIE.status eq 0}">
                                    <br/><a href="IEBillController?action=review&reject=reject&ieBillID=${objIE.id}"> <img src="images/reject.png" alt="Reject"/> </a>
                                </c:if>
                            </td>
                        </tr>
                            <c:set var="integer" value="${integer+1}"></c:set>
                        </c:forEach>
                    </table>
                </form>
                </div>
		<!-- E Body Content -->

                <!-- S Footer -->
			<jsp:include page="block/footer.jsp" />
		<!-- E Footer -->
	</div>
    </body>
</html>
